package cn.xzq.cstm.domain;

import java.util.List;
 
public class PageBean<T> {
	private List<T> datas;// 当前页记录数, 需要传递
	private int totalRecord;// 总记录数, 需要传递
	private int currPageCode;// 当前页码, 需要传递
	private int pageSize;// 每页记录数, 需要传递
	private int totalPage;// 总页数, 需要计算
	private int currPageBeginIndex; //需要计算
	
	private String url;//保存页面传过来的参数，查询条件
	
	public PageBean() {
		super();
	}
	
	public PageBean(List<T> datas, int totalRecord, int currPageCode, int pageSize, int totalPage,
			int currPageBeginIndex) {
		super();
		this.datas = datas;
		this.totalRecord = totalRecord;
		this.currPageCode = currPageCode;
		this.pageSize = pageSize;
	}

	
	public List<T> getDatas() {
		return datas;
	}

	public void setDatas(List<T> datas) {
		this.datas = datas;
	}

	public int getTotalRecord() {
		return totalRecord;
	}

	public void setTotalRecord(int totalRecord) {
		this.totalRecord = totalRecord;
	}

	public int getCurrPageCode() {
		return currPageCode;
	}

	public void setCurrPageCode(int currPageCode) {
		this.currPageCode = currPageCode;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getCurrPageBeginIndex() {
		return currPageBeginIndex;
	}

	public void setCurrPageBeginIndex(int currPageBeginIndex) {
		this.currPageBeginIndex = currPageBeginIndex;
	}

	
	public void setTotalPage() {
	}

	public int getTotalPage() {
		totalPage = totalRecord / pageSize;
		return totalRecord%pageSize == 0 ? totalPage : totalPage+1;
	}
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Override
	public String toString() {
		return "PageBean [datas=" + datas + ", totalRecord=" + totalRecord + ", currPageCode=" + currPageCode
				+ ", pagesize=" + pageSize + ", totalPage=" + totalPage + ", currPageBeginIndex=" + currPageBeginIndex
				+ "]";
	}

}
